package fenyu.personblob.savepath;

import fenyu.personblob.bean.databean.User;
import fenyu.personblob.bean.databean.blob.Blob;
import fenyu.personblob.bean.databean.blob.BlobComment;
import fenyu.personblob.bean.databean.logs.LogBean;
import fenyu.personblob.bean.strategy.Strategy;
import fenyu.personblob.savepath.strategy.DefaultFindUserByNameStrategy;

import java.security.KeyPair;
import java.util.List;

/**
 * create at 2018/12/21 22:29
 *
 * @author 纷羽 <gzj0078@gmail.com>
 */
public abstract class SaveDoor {

    public abstract DefaultSavePath<Blob> getBlobSavePath();

    public abstract DefaultSavePath<BlobComment> getBlobCommentSavePath();

    public abstract DefaultSavePath<User> getUserSavePath();

    public abstract List<LogBean> getlog();

    public abstract void createlog(Integer type, String log);

    public abstract String printAllLogs();

    public abstract KeyPair getKEY_PAIR();

    public void sysprintAllLogs() {
        System.out.println(printAllLogs());
    }

    private Strategy findbyname = new DefaultFindUserByNameStrategy();

    /**
     * 通过用户名查找用户
     *
     * @param name 用户名
     * @return 用户对象
     */
    public User findByName(String name) {
        return (User) findbyname.todo(name);
    }

}
